package cn.hunan.dzzk.dao;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.criterion.Example;

import cn.hunan.dzzk.entity.TUser;
import cn.hunan.dzzk.util.HibernateSessionFactory;

public class TUserDAOImpl implements TUserDAO {

	private static final Log log = LogFactory.getLog(TUserDAO.class);

	public boolean ValidateUser(TUser t) {
		Session session = HibernateSessionFactory.getSession();

//		List results = session.createCriteria("cn.hunan.dzzk.entity.TUser")
//				.add(Example.create(t)).list();
		List results = session.createQuery("from TUser as u where u=?").setEntity(0, t).list();
		
		if(results.size() == 1) {
			return true;
		} else {
			return false;
		}

	}

}
